package marvin.music.rest;

public class ServiceURIs {
	
	private static final String lineDelimiter = "<br/>";
	
	public static final String PARAM_CLIENT_NAME = "client";
	public static final String PARAM_PATH = "path";
	public static final String PARAM_TYPE = "type";
	
	public static final String LIST_CLIENTS = "/list/clients";
	public static final String PLAY_WEB_RADIO = "/play/radio/{"+PARAM_CLIENT_NAME+"}/{"+PARAM_PATH+"}";
	public static final String PLAY_FILE = "/play/file/{"+PARAM_CLIENT_NAME+"}/{"+PARAM_PATH+"}/{"+PARAM_TYPE+"}";
	public static final String ADD_TO_PLAY_LIST = "/add/list/{"+PARAM_CLIENT_NAME+"}/{"+PARAM_PATH+"}/{"+PARAM_TYPE+"}";
	public static final String PLAY_LIST_PLAY = "/playlist/play/{"+PARAM_CLIENT_NAME+"}";
	public static final String PLAY_LIST_CLEAR = "/playlist/empty/{"+PARAM_CLIENT_NAME+"}";
	public static final String STREAM_PAUSE = "/stream/pause/{"+PARAM_CLIENT_NAME+"}";
	public static final String STREAM_RESUME = "/stream/resume/{"+PARAM_CLIENT_NAME+"}";
	public static final String STREAM_STOP = "/stream/stop/{"+PARAM_CLIENT_NAME+"}";
	public static final String STREAM_NEXT = "/stream/next/{"+PARAM_CLIENT_NAME+"}";
	public static final String STREAM_PREVIOUS = "/stream/previous/{"+PARAM_CLIENT_NAME+"}";
	
	public static String getServicesDescription(){
		String desc = "";
		
		desc +=generateServiceBlock(LIST_CLIENTS, "Get list of connected clients", "http://localhost:8081/marvin-music-server/rest/"+LIST_CLIENTS);

		return desc;
	}
	
	private static String generateServiceBlock(String uri, String description, String example){
		String block = generateURI(uri);
		block += generateDescription(description);
		block += generateExample(example);
		block += lineDelimiter;
		
		return block;
	}

	public static String generateURI(String uri) {
		return "- URI: "+ lineDelimiter + uri + lineDelimiter;
	}
	
	private static String generateExample(String exemple){
		return "- Example: " + lineDelimiter + exemple + lineDelimiter;
	}
	
	private static String generateDescription(String desc){
		return "- Description: " + lineDelimiter + desc + lineDelimiter;
	}
}
